home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!samsung!munnari.oz.au!metro!sunaus.oz!newstop!sun!rand.org
- From: bobs%moose@rand.org (Robert Schwartzkopf)
- Newsgroups: comp.sources.x
- Subject: v07i034: xmeter - Display rstat statistics for X11R4, Patch1, Part01/01
- Message-ID: <135597@sun.Eng.Sun.COM>
- Date: 12 May 90 07:52:55 GMT
- Sender: news@sun.Eng.Sun.COM
- Lines: 149
- Approved: argv@sun.com
-
- Submitted-by: Robert Schwartzkopf <bobs%moose@rand.org>
- Posting-number: Volume 7, Issue 34
- Archive-name: xmeter/patch1
- Patch-To: xmeter: Volume 6, Issue 98
-
- Changes in patch 1 include plugging a memory leak and cleaning up my
- Imakefile a little. I've also included a README file that should have been
- included in the original posting.
-
- Bob Schwartzkopf (bobs@rand.org)
-
- # This is a shell archive.
- # Remove everything above and including the cut line.
- # Then run the rest of the file through sh.
- #----cut here-----cut here-----cut here-----cut here----#
- #!/bin/sh
- # shar: Shell Archiver
- # Run the following text with /bin/sh to create:
- # README
- # patch1
- # This archive created: Fri May 4 16:36:11 1990
- cat << \SHAR_EOF > README
- xmeter displays a histogram of data returned by rstat(3). It can be
- told to monitor multiple hosts, or to monitor multiple statistics on the
- same host. Known to run on sun3s and sun4s running SunOS 4.0.3 under
- X11 R4.
-
- Author: Bob Schwartzkopf (bobs@rand.org)
- The RAND Corporation
- 1700 Main Street
- Santa Monica, CA 90406-2138
- SHAR_EOF
- if test 331 -ne "`wc -c README`"
- then
- echo shar: error transmitting README '(should have been 331 characters)'
- fi
- cat << \SHAR_EOF > patch1
- Prereq: 0
- *** /tmp/,RCSt1a12217 Fri May 4 16:31:31 1990
- --- patchlevel.h Fri May 4 12:37:00 1990
- ***************
- *** 1 ****
- ! #define PATCHLEVEL 0
- --- 1 ----
- ! #define PATCHLEVEL 1
- *** /tmp/,RCSt1a12220 Fri May 4 16:31:32 1990
- --- xmeter.c Fri May 4 12:33:56 1990
- ***************
- *** 8,13 ****
- --- 8,29 ----
- * to run under X11 R4 on sun3s and sun4s running SunOS 4.0.3.
- */
-
- + #ifndef lint
- + static char *RCSid="$Header: /a/moose/lhome/src/rand/xmeter/RCS/xmeter.c,v 1.2 90/05/04 12:31:52 bobs Exp $";
- + #endif lint
- +
- + /*
- + * $Log: xmeter.c,v $
- + * Revision 1.2 90/05/04 12:31:52 bobs
- + * Fix memory leak in getport(). Wasn't freeing resources allocated by
- + * clntudp_create when clnt_call failed. Also removed explicit calls
- + * to close sockets since clnt_destroy() does this.
- + *
- + * Revision 1.1 90/04/30 14:33:59 bobs
- + * Initial revision
- + *
- + */
- +
- #include <stdio.h>
- #include <sys/time.h>
- #include <sys/param.h>
- ***************
- *** 554,563 ****
- return (-1);
- sh->s = RPC_ANYSOCK;
- if (!(sh->clnt = clntudp_create (&sh->addr, RSTATPROG, RSTATVERS,
- ! ptto, &sh->s))) {
- ! close (sh->s);
- return (-1);
- - }
- ost = NULL;
- sh->idx = 0;
- } else {
- --- 570,577 ----
- return (-1);
- sh->s = RPC_ANYSOCK;
- if (!(sh->clnt = clntudp_create (&sh->addr, RSTATPROG, RSTATVERS,
- ! ptto, &sh->s)))
- return (-1);
- ost = NULL;
- sh->idx = 0;
- } else {
- ***************
- *** 568,574 ****
- &sh->st[sh->idx], tto);
- if (cs != RPC_SUCCESS) {
- clnt_destroy (sh->clnt);
- - close (sh->s);
- sh->clnt = NULL;
- return (-1);
- }
- --- 582,587 ----
- ***************
- *** 596,607 ****
- if (!(c = clntudp_create (&sh->addr, PMAPPROG, PMAPVERS, ptto, &sh->s)))
- return (-1);
- cs = clnt_call (c, PMAPPROC_GETPORT, xdr_pmap, &pm, xdr_u_short, &p, tto);
- ! close (sh->s);
- ! if (cs == RPC_SUCCESS) {
- ! clnt_destroy (c);
- ! return (p);
- ! } else
- ! return (-1);
- }
-
- /*
- --- 609,616 ----
- if (!(c = clntudp_create (&sh->addr, PMAPPROG, PMAPVERS, ptto, &sh->s)))
- return (-1);
- cs = clnt_call (c, PMAPPROC_GETPORT, xdr_pmap, &pm, xdr_u_short, &p, tto);
- ! clnt_destroy (c);
- ! return (cs == RPC_SUCCESS ? p : -1);
- }
-
- /*
- *** /tmp/,RCSt1a12223 Fri May 4 16:31:33 1990
- --- Imakefile Mon Apr 30 14:41:02 1990
- ***************
- *** 3,8 ****
- SYS_LIBRARIES = -lrpcsvc
- SRCS = xmeter.c
- OBJS = xmeter.o
- - CDEBUGFLAGS = -O
-
- ComplexProgramTarget(xmeter)
- --- 3,7 ----
- SHAR_EOF
- if test 2662 -ne "`wc -c patch1`"
- then
- echo shar: error transmitting patch1 '(should have been 2662 characters)'
- fi
- # End of shell archive
- exit 0
-
- dan
- ----------------------------------------------------
- O'Reilly && Associates argv@sun.com / argv@ora.com
- Opinions expressed reflect those of the author only.
-